hackerrank word order problem solution in python programming